package Frames_juego.efectos;

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;

import javax.swing.JButton;

@SuppressWarnings("serial")
public class JGradientButton extends JButton{
	
	private Color color1;
	private Color color2;
    
	public JGradientButton(Color c1, Color c2)
	{
        color1=c1;
        color2=c2;
        setContentAreaFilled(false);
        setFocusPainted(false); // used for demonstration
        
       
       
    }

    @Override
    protected void paintComponent(Graphics g)
    {
    	
        Graphics2D g2 = (Graphics2D)g.create();
        g2.setPaint(new GradientPaint(
                new Point(0, 0), 
                color1, 
                new Point(0, getHeight()), 
                color2));
        g2.fillRect(0, 0, getWidth(), getHeight());
        g2.dispose();

        super.paintComponent(g);
    }

   

}